/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.imenu.web.client.servlet;

import com.imenu.ejb.ImenuMenuFacade;
import com.imenu.entity.ImenuMenu;
import java.io.IOException;
import java.util.List;
import javax.ejb.EJB;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author yunzi
 */
@WebServlet(name = "ClientMenuServlet", urlPatterns = {"/clientMenu"})
public class ClientMenuServlet extends BaseServlet<ImenuMenu> {

    @EJB ImenuMenuFacade menuFacade;
    /**如果command不能match到任何方法,默认显示的页面*/
    @Override
    protected void defaultAction(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("com.imenu.web.client.ClientMenuServlet.defaultAction() request.getRequestURL() = " + request.getRequestURL());
        List<ImenuMenu> menuList = menuFacade.findAll();
        request.setAttribute("menuList", menuList);
        this.forward(request, response, "/index.jsp");
    }
}
